<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="java.util.*"%>
<%@page import="util.PhysicalFeature.*"%>
<%@page import="util.PhysicalFeatureUtil"%>

<%
	List<Gender> genders = PhysicalFeatureUtil.getGenders();
	request.setAttribute("genders", genders);

	List<Skin> skins = PhysicalFeatureUtil.getSkins();
	request.setAttribute("skins", skins);

	List<Eyes> eyes = PhysicalFeatureUtil.getEyes();
	request.setAttribute("eyes", eyes);

	List<Hair> hairs = PhysicalFeatureUtil.getHairs();
	request.setAttribute("hairs", hairs);
%>

<c:set var="count" value="1" scope="request" />
<c:if test="${actorJobCount ne null }">
	<c:set var="count" value="${actorJobCount}" scope="request" />
</c:if>

<div id="divAA${count}">
	<c:if test="${not empty actorjob }">
		<input type="hidden" name="ajid${count}" value="${actorjob.ajid }" />
	</c:if>
	<table>
		<tr>
			<td>Gender</td>
			<td><c:forEach var="gender" items="${genders}">
					<c:choose>
						<c:when test="${not empty actorjob }">
							<c:set var="genderCount" value="0" scope="request" />
							<c:forEach var="g" items="${actorjob.genders}">
								<c:if test="${g.genderName eq gender.genderName}">
									<c:set var="genderCount" value="${genderCount+1}"
										scope="request" />
								</c:if>
							</c:forEach>
							<c:choose>
								<c:when test="${genderCount> 0 }">
									<input type="checkbox" name="genderAA${count}"
										value="${gender.genderName}" checked="checked" />${gender.genderShowName}
								</c:when>
								<c:otherwise>
									<input type="checkbox" name="genderAA${count}"
										value="${gender.genderName}" />${gender.genderShowName}
								</c:otherwise>
							</c:choose>
						</c:when>
						<c:otherwise>
							<input type="checkbox" name="genderAA${count}"
								value="${gender.genderName}" />${gender.genderShowName}
						</c:otherwise>
					</c:choose>
				</c:forEach></td>
		</tr>
		<tr>
			<td>Age</td>
			<td><input type="text" name="ageAA${count}"
				value="<c:if test="${not empty actorjob && actorjob.fromAge ne -1 }" >${actorjob.fromAge }</c:if>" />
				* (integer)</td>
		</tr>
		<tr>
			<td>Height</td>
			<td><input type="text" name="heightAA${count}"
				value="<c:if test="${not empty actorjob && actorjob.height ne -1}" >${actorjob.height }</c:if>" />
				* (integer)</td>
		</tr>
		<tr>
			<td>Weight</td>
			<td><input type="text" name="weightAA${count}"
				value="<c:if test="${not empty actorjob && actorjob.weight ne -1}" >${actorjob.weight }</c:if>" />*
				(integer)</td>
		</tr>
		<tr>
			<td>Hair</td>
			<td><c:forEach var="hair" items="${hairs}">
					<c:choose>
						<c:when test="${not empty actorjob }">
							<c:set var="hairCount" value="0" scope="request" />
							<c:forEach var="h" items="${actorjob.hairs}">
								<c:if test="${h.hairName eq hair.hairName}">
									<c:set var="hairCount" value="${hairCount+1}" scope="request" />
								</c:if>
							</c:forEach>
							<c:choose>
								<c:when test="${hairCount> 0 }">
									<input type="checkbox" name="hairAA${count}"
										value="${hair.hairName}" checked="checked" />${hair.hairShowName}
								</c:when>
								<c:otherwise>
									<input type="checkbox" name="hairAA${count}"
										value="${hair.hairName}" />${hair.hairShowName}
								</c:otherwise>
							</c:choose>
						</c:when>
						<c:otherwise>
							<input type="checkbox" name="hairAA${count}"
								value="${hair.hairName}" />${hair.hairShowName}
						</c:otherwise>
					</c:choose>

				</c:forEach></td>
		</tr>
		<tr>
			<td>Skin</td>
			<td><c:forEach var="skin" items="${skins}">
					<c:choose>
						<c:when test="${not empty actorjob }">
							<c:set var="skinCount" value="0" scope="request" />
							<c:forEach var="s" items="${actorjob.skins}">
								<c:if test="${s.skinName eq skin.skinName}">
									<c:set var="skinCount" value="${skinCount+1}" scope="request" />
								</c:if>
							</c:forEach>
							<c:choose>
								<c:when test="${skinCount> 0 }">
									<input type="checkbox" name="skinAA${count}"
										value="${skin.skinName}" checked="checked" />${skin.skinShowName}
								</c:when>
								<c:otherwise>
									<input type="checkbox" name="skinAA${count}"
										value="${skin.skinName}" />${skin.skinShowName}
								</c:otherwise>
							</c:choose>
						</c:when>
						<c:otherwise>
							<input type="checkbox" name="skinAA${count}"
								value="${skin.skinName}" />${skin.skinShowName}
						</c:otherwise>
					</c:choose>
				</c:forEach></td>
		</tr>
		<tr>
			<td>Eyes</td>
			<td><c:forEach var="eye" items="${eyes}">

					<c:choose>
						<c:when test="${not empty actorjob }">
							<c:set var="eyeCount" value="0" scope="request" />
							<c:forEach var="e" items="${actorjob.eyes}">
								<c:if test="${e.eyesName eq eye.eyesName}">
									<c:set var="eyeCount" value="${eyeCount+1}" scope="request" />
								</c:if>
							</c:forEach>
							<c:choose>
								<c:when test="${eyeCount> 0 }">
									<input type="checkbox" name="eyesAA${count}"
										value="${eye.eyesName}" checked="checked" />${eye.eyesShowName}
								</c:when>
								<c:otherwise>
									<input type="checkbox" name="eyesAA${count}"
										value="${eye.eyesName}" />${eye.eyesShowName}
								</c:otherwise>
							</c:choose>
						</c:when>
						<c:otherwise>
							<input type="checkbox" name="eyesAA${count}"
								value="${eye.eyesName}" />${eye.eyesShowName}
						</c:otherwise>
					</c:choose>


				</c:forEach></td>
		</tr>
	</table>
	<table>
		<tr>
			<td>Description</td>
			<td>Count</td>
		</tr>
		<tr>
			<td><textarea rows="4" cols="50" name="descriptionAA${count}"> <c:if
						test="${not empty actorjob }">${actorjob.description }</c:if>
				</textarea></td>
			<td><input type="text"
				value="<c:choose><c:when test="${not empty actorjob }" >${actorjob.count }</c:when><c:otherwise>1</c:otherwise></c:choose>"
				name="countAA${count}" /> * (integer)</td>
		</tr>
	</table>
	<input type="button" id="cancelAA${count }"
		onclick="javascript:cancelJob('AA${count}');" value="Cancel"
		alt="AA${count}" />
	<div class="grid_24 hr-line2"></div>
</div>